<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>拉萨市财政局投资评审管理系统  </title>
    <link rel="stylesheet" href="css/style.css">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<!--login-container start-->
<div class="login-container">
    <div class="login-box">
        <div class="login-content">
            <div class="login-logo"><img src="images/logo.png"></div>
            <div class="login-bd">
                <div class="login-tit">欢迎登录</div>
                <div class="login-ul">
                    <div class="login-li">
                        <div class="login-label">
                            <img src="images/login1.png">
                            <span>用户名：</span>
                        </div>
                        <div class="login-input"><input id="username" type="text"></div>
                    </div>
                    <div class="login-li">
                        <div class="login-label">
                            <img src="images/login2.png">
                            <span>密码：</span>
                        </div>
                        <div class="login-input"><input id="auth" type="password"></div>
                    </div>
                </div>
                <div class="login-bot">
                    <button class="login-btn" onclick="login()">立即登录</button>
                </div>
                <div class="login-pass">
                    <a class="login-pass-a" href="/forgetpwd.html">忘记密码？</a>
                </div>
            </div>
        </div>
    </div>
</div>
<!--login-container end-->




<script type="text/javascript">
	var HTTP_HOST = "http://127.0.0.1/";

function login(){

var user = $("#username").val();
var password = $("#auth").val();
// return false;
if(!user || !password){

    alert("用户名密码不能为空");
    return false;
}
    if (user !=null && password !=null) {


        $.post(HTTP_HOST+"api/Auth/login",{"userAccount":user,"userPassword":password},function(res){
		console.log(res);

			if(res.result != "errpwd"){
				
				var href = null;
					switch(res.result.type){

                    case 0:
                            href=HTTP_HOST+"additem.html";
                            break;
                    case 1:
                            href=HTTP_HOST+"sluserindex.html";
                            break;
                    case 3:
                            href = HTTP_HOST+"leaaderindex.html";
                            break;
                    case 4:
                            href = HTTP_HOST+"exptindex.html";
                            break;
                    case 5:
                            href = HTTP_HOST+"exptindex.html";
                            break;
                    case 2:
                            href = HTTP_HOST+"ownerindex.html";
                            break;
                    case 6:
                        href = HTTP_HOST+"pszyindex.html";
                        break;
                    case 7:
                        href = HTTP_HOST+"user1.html";
                        break;


            }
			window.location.href = href;
			}else{
                astr = "";
                $("#auth").val("");
                alert("认证失败，请联系管理员！");
            }



        },"JSON");



    }





}





</script>


</body>
</html>
